package com.crs.dto;

import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.time.LocalDateTime;

@Data
public class ResourcesPageQueryDTO {

    private int page;      // 默认第1页
    private int pageSize; // 默认每页10条

    // 计算偏移量（供SQL使用）
    public long getOffset() {
        return (long) (page - 1) * pageSize;
    }

    private String name;

    private Integer status;

    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime beginTime;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime endTime;

    private Long ownerId;
    private String username;

//    private Long ownerId;

    private String categoryName;
    private Integer categoryId;
}
